home *** CD-ROM | disk | FTP | other *** search
- /*
- * CBLibrary - SFformats
- * Copyright (C) 2003 Chris Bazley
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
- /* Star Fighter 3000 data formats
- 13.09.03 CJB Changed the names of various of the types and structures.
- */
-
- #ifndef SFformats_h
- #define SFformats_h
-
- /*
- Hill and polygon colours
- */
-
- #define FILETYPE_FEDNET 0x154
-
- /*
- Level animations
- Purpose: Holds a list of ground map animations for a given mission.
- */
-
- #define FILETYPE_ANIMS 0x408
-
- /* (the following may be a load of crap BTW) */
- typedef struct _SF_AnimationsHdr
- {
- int num_animations; /* Number of animations held */
- int free_A;
- int free_B;
- int free_C;
- } SF_AnimationsHdr;
-
- typedef struct _SF_Animation
- {
- int map_offset;
- int timer_counter;
- int reset_timer_and_current; /* b1,b0 = Timer reset ctr, b3,b2 = Current Spr# */
- int tile_1; /* Sprite # byte, Expanded on load to sprite location */
- int tile_2;
- int tile_3;
- int tile_4;
- } SF_Animation;
-
- /*
- Polygonal graphics set
- Purpose: Defines a complete set of polygonal objects - including all
- fighters, spaceships, ground installations, bonus coins etc.
- */
-
- #define FILETYPE_POLYOBJS 0x300
-
- typedef int SF_PolyObjectsSetHdr; /* FILE FORMAT UNKNOWN !!! */
-
- /*
- Ground map/overlay file format
- Purpose: Holds a base ground map or mission-specific overlay.
- */
-
- #define FILETYPE_BASEMAP 0x400
- #define FILETYPE_LEVELMAP 0x401
-
- typedef char SF_GroundMap[256][256];
-
- /*
- Map tiles stamp file format
- Purpose: Used by the level editor to hold smaller map areas
- */
-
- typedef struct _SF_GroundMapStampHdr
- {
- char file_version; /* for future expansion */
- char width;
- char height;
- char free;
- /*-- tiles (same format as map overlay) follow here in memory --*/
- char tiles[];
- } SF_GroundMapStampHdr;
-
- /*
- Object map/overlay file format
- Purpose: Holds a base ground objects grid or mission-specific overlay.
- */
-
- #define FILETYPE_BASEOBJS 0x402
- #define FILETYPE_LEVELOBJS 0x403
-
- typedef char SF_ObjectsGrid[128][128];
-
- /*
- Sky colour definition file
- Purpose: Stores the colours used to paint a planetary atmosphere.
- */
-
- #define FILETYPE_SKYCOLS 0x404
-
- typedef struct _SF_SkyColours
- {
- int min_sky_height;
- int min_stars_height;
- unsigned int shade[126];
- } SF_SkyColours;
-
- /*
- Mission file format
- Purpose: Stores all details about a mission, including the text
- briefing, location briefings, details of flying ships,
- flightpaths, ship performance data, map and graphics to use.
- */
-
- #define FILETYPE_MISSION 0x405
-
- /* Ground checks - triggered when object destroyed */
- #define SF_TRIGGER_FIXSCANNERS 13
- #define SF_TRIGGER_FRIENDLYDEAD 11
- #define SF_TRIGGER_MISSIONTIMER 10
- #define SF_TRIGGER_CASHBONUS 9
- #define SF_TRIGGER_CRIPPLESHIPTYPE 8
- #define SF_TRIGGER_DUMMY 7 /* may be used as base of chain reaction */
- #define SF_TRIGGER_CHAINREACTION 6
- #define SF_TRIGGER_DEFENCETIMER 5
- #define SF_TRIGGER_MINES_BONUS 4
- #define SF_TRIGGER_BOMBS_BONUS 3
- #define SF_TRIGGER_MEGALASER_BONUS 2
- #define SF_TRIGGER_MULTIATA_BONUS 1
- #define SF_TRIGGER_MISSIONTARGET 0
-
- typedef struct _SF_Trigger
- {
- char x_pos;
- char y_pos;
- char action_type;
- char action_param;
- } SF_Trigger;
-
- typedef int SF_LocationBrief;
-
- typedef struct _SF_ShipPerfData
- {
- int laser_freq;
- int laser_type;
- int engine; /* Fighters only */
- int control; /* Fighters only */
- int shields;
- int ATA_freq; /* Fighters only */
- int pleb_launch_freq; /* Big ships only */
- int num_plebs; /* Big ships only */
- } SF_ShipPerfData;
-
- #define SHIPADDER_FLAGS1_STARTMODE (1u << 0)
- #define SHIPADDER_FLAGS1_FRIENDLY (1u << 2)
- #define SHIPADDER_FLAGS1_CLOAKED (1u << 3)
-
- #define SHIPADDER_STARTMODE_ATTACK 0
- #define SHIPADDER_STARTMODE_FLIGHTPATH 1
- #define SHIPADDER_STARTMODE_FOLLOWSHIP 2
-
- #define SHIPADDER_FLAGS2_IGNOREATTACK (1u << 0)
- #define SHIPADDER_FLAGS2_PROXIMITYACTION (1u << 1)
-
- #define SHIPADDER_MISSIONSIG_NONE 0
- #define SHIPADDER_MISSIONSIG_DESTROY 1
- #define SHIPADDER_MISSIONSIG_PROTECT 2
- #define SHIPADDER_MISSIONSIG_FINISHPATH 3
- #define SHIPADDER_MISSIONSIG_NOTLAND 5
-
- #define SHIPADDER_BIGSHIP_MOVES 0
- #define SHIPADDER_BIGSHIP_SPINS 1
- #define SHIPADDER_BIGSHIP_ROTATES 2
- #define SHIPADDER_BIGSHIP_STATIONARY 3
-
- typedef struct _SF_ShipAdderData
- {
- int xpos;
- int ypos;
- int height;
- char type; /* (1-4, 13-15, 21) */
- char flags_1;
- /* [b0-b1] Start mode (0=Attack, 1=Flightpath, 2=Follow ship)
- [b2] Allegiance (0=Enemy, 1=Friendly)
- [b3] Cloaking on? (0=No, 1=Yes) */
- char flightpath_startpoint;
- char FP_or_ship_to_follow;
- /* If flightpath, then path number (0-7)
- If ship follow, then ship number (0-15, 255=follow players ship) */
-
- int x_follow_offset;
- int y_follow_offset;
- int height_follow_offset;
- char mission_significance;
- /* (0=None,
- 1=Must kill,
- 2=Must survive,
- 3=Must survive and finish flightpath,
- 4=No special datablock
- 5=Must not land)
- */
- char flags_2;
- /* [b0] Ignore incoming attack? (0=No, 1=Yes)
- [b1] On flightpath, player proximity action
- (0=Ignore, 1=Join formation (Fr) or attack(En)) */
- char bigship_movement;
- /* 0=fly around
- 1=spinning top space station
- 2=rotating wheel space station
- 3=don't move */
- char direction_and_pilot;
- /* [b0-b3] Pilot's name (0-15)
- [b4-b7] Starting direction (0-15) */
- } SF_ShipAdderData;
-
- typedef struct _SF_FlightPathPoint
- {
- char X_coord;
- char Y_coord;
- char Z_coord;
- char waste;
- } SF_FlightPathPoint;
-
- typedef struct _SF_FlightPath
- {
- int number_of_points;
- SF_FlightPathPoint points[64];
- } SF_FlightPath;
-
- /* Special mission variables */
- #define SV_SCANNER_KNACKERED 0
- #define SV_NO_GROUND_DAMAGE 1
-
- typedef char SF_Filename[12];
-
- typedef struct _SF_Mission
- {
- /* Player starting position */
- char player_xpos;
- char player_ypos;
- char player_height;
- char player_direction;
-
- /* Special ship details */
- char player_has_specialship; /* (0=No, 1=Yes) */
- char specialship_laser_type;
- char specialship_engine;
- char specialship_control;
- char specialship_shields;
- char specialship_ATA;
- char specialship_ATG;
- char specialship_mines;
- char specialship_bombs;
- char specialship_megalaser;
- char specialship_multiATA;
- char specialship_shiptype;
-
- /* Misc stuff */
- char num_hits_against_allowed;
- char plebadder_type1_2;
- char plebadder_type3_4;
- char space_mission; /* (0=No, 1=Yes) */
- char cloud_colour_1;
- char cloud_colour_2;
- char dock_to_finish; /* (0=No, 1=Yes) */
- char start_docked; /* (255=No else Yes) */
-
- /* Ground targets/check objects */
- int num_ground_checks;
- SF_Trigger ground_checks[64];
-
- /* Location briefings */
- int num_location_briefings;
- SF_LocationBrief location_briefings[16];
-
- /* Timers */
- int mission_timer;
- int defence_timer;
-
- /* General mission difficulty */
- char laser_fire_freq;
- char laser_fire_type;
- char launch_type_and_number;
- char hangar_launch_freq;
-
- /* Mission number */
- int level_number;
- int pyramid_number;
-
- /* Special mission variables */
- char special_vars[32];
-
- /* Ship performance data */
- SF_ShipPerfData ships_performance[7];
-
- /* Flying ships list */
- int num_ships_flying;
- SF_ShipAdderData ships_flying[32];
-
- /* Flightpaths */
- int num_flightpaths;
- SF_FlightPath flightpaths[8];
-
- /* Associated / component files */
- SF_Filename map_tiles_basemap;
- SF_Filename map_tiles_levmap;
- SF_Filename ground_objects_basemap;
- SF_Filename ground_objects_levmap;
- SF_Filename animations;
- SF_Filename map_tiles_set;
- SF_Filename polygonal_objects_set;
- SF_Filename sky_colour_bands;
- SF_Filename planet_pictures_set;
- SF_Filename palette;
- SF_Filename hill_colours;
-
- /* Mission and location briefing text */
- int textbriefs;
- int textvisits;
- int textstroff[19];
- char title[32];
- char textstrings[3*1024];
- } SF_Mission;
-
- typedef struct _SF_TextData
- {
- int header[12];
- /*-- string follows here in memory, terminated by 255 --*/
- char string[];
- } SF_TextData;
-
-
- /*
- Planets file format
- Purpose: Contains the pictures of distant planets painted onto the sky.
- */
-
- #define FILETYPE_PLANETS 0x406
-
- #define SF_PLANET_WIDTH 36
- #define SF_PLANET_HEIGHT 36
-
- typedef char SF_PlanetBitmap[SF_PLANET_WIDTH][SF_PLANET_HEIGHT];
-
- typedef struct _SF_PlanetPaintOffset
- {
- int xoffset; /* (Obsolete?) */
- int yoffset; /* (Obsolete?) */
- } SF_PlanetPaintOffset;
-
- typedef struct _SF_PlanetDataOffset
- {
- int dataoffset;
- int maskoffset; /* (Obsolete?) */
- } SF_PlanetDataOffset;
-
- typedef struct _SF_PlanetsSetHdr
- {
- int lastplanet_num;
- SF_PlanetPaintOffset paintoffsets[2]; /* (Obsolete?) */
- SF_PlanetDataOffset dataoffsets[2];
- /*-- planets follow here in memory --*/
- SF_PlanetBitmap planets[];
- } SF_PlanetsSetHdr;
-
- /*
- Map tile graphics set format
- Purpose: Contains the the full range of available map tiles in a given set.
- */
-
- #define FILETYPE_MAPTILES 0x407
-
- #define SF_MAPTILE_WIDTH 16
- #define SF_MAPTILE_HEIGHT 16
-
- typedef char SF_MapTile[SF_MAPTILE_WIDTH][SF_MAPTILE_HEIGHT];
-
- typedef struct _SF_MapTilesSetHdr
- { int lasttile_num;
- char splash_anim_1[4];
- char splash_anim_2[4];
- char splash_2_triggers[4];
- /*-- tiles follow here in memory --*/
- SF_MapTile tiles[];
- } SF_MapTilesSetHdr;
-
- /*
- Hill colours format
- Purpose: Gives the colour palette used for the polygonal mountains.
- */
-
- typedef char SF_HillCols[3][12];
-
- /*
- Polygon colours format
- Purpose: Maps the 320 logical colours used on polygonal objects in the
- game to the standard static 256 colours available in mode 13.
- */
-
- typedef union _SF_ColourMap
- {
- /* Plain and simple */
- char colour_mappings[320];
-
- /* Area allocations */
- struct {
- char static_colours[256];
-
- struct {
- char player_engine[4];
- char fighter_engine[4];
- char cruiser_engine[4];
- char super_engine[4];
- } engine_colours;
-
- struct {
- char enemy_ships[4];
- char friendly_ships[4];
- char player_ship[4];
- } fast_flashing;
-
- struct {
- char ground_obj_1[4];
- char ground_obj_2[4];
- char misc_1[4];
- char misc_2[4];
- } med_flashing;
-
- char player_livery[20];
- } areas;
- } SF_ColourMap;
-
- /*
- Music tracks format
- Purpose: Used by SFX_Handler module music player.
- */
-
- typedef struct _SF_MusicCommand {
- char pitch;
- char octave_and_volume;
- char sample_and_command;
- char repeats;
- } SF_MusicCommand;
-
- /* Encoding of note data:
- bits... 28 24 20 16 12 8 4 0
- {repeats}{ }{command}{sample}{volume}{octave}{ }{pitch} */
-
- typedef struct _SF_MusicLine {
- SF_MusicCommand commands[4];
- } SF_MusicLine;
- /* (each line is 16 bytes) */
-
- typedef struct _SF_MusicSheet {
- SF_MusicLine lines[64];
- } SF_MusicSheet;
- /* (each sheet is 1024 bytes) */
-
- typedef struct _SF_MusicHdr {
- char tempo; /* Metronome value */
- char free[15]; /* FREE Header data */
- char note_trans[16]; /* Logical to actual voice mapping */
- int number_sheets; /* Number of sheets */
- int number_play; /* obsolete */
- char sheets_order[64]; /* Sheets play order (255 Term) */
- /*-- sheets follow here in memory --*/
- SF_MusicSheet sheets[];
- } SF_MusicHdr;
-
- #endif
-